package com.demo.salary.abstracttransactions;


import com.demo.salary.payrollimplementation.HoldMethod;
import com.demo.salary.payrolldomain.Employee;
import com.demo.salary.payrolldomain.PayMethod;
import com.demo.salary.payrolldomain.PaymentClassification;
import com.demo.salary.payrolldomain.PaymentSchedule;
import com.demo.salary.payrolldatabase.PayrollDatabase;
import com.demo.salary.transactionapplication.Transaction;

public abstract class AddEmployeeTransaction implements Transaction {
    int empId;
    String name;
    String address;

    public AddEmployeeTransaction(int empId, String name, String address) {
        this.empId = empId;
        this.name = name;
        this.address = address;
    }

    public  abstract PaymentClassification getClassification();

    public  abstract PaymentSchedule getSchedule();


    public void execute() {
        PaymentClassification pc = getClassification();
        PaymentSchedule ps = getSchedule();
        PayMethod pm = new HoldMethod();

        Employee employee = new Employee(empId, name, address);
        employee.setClassification(pc);
        employee.setSchedule(ps);
        employee.setMethod(pm);

        PayrollDatabase.addEmployee(empId, employee);
    }

}
